<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class IdentityModel extends Model
{
    protected $table = 'identity';
    protected $guarded = [];


    public function permissionList() {
        return $this->hasManyThrough(
            PermissionListModel::class,
            IdentityPermissionListModel::class,
            'identity_id',
            'id',
            'id',
            'permission_list_id'
        );
    }

    public function menuOperation() {
        return $this->hasManyThrough(
            MenuModel::class,
            PermissionListModel::class,
            'permission_list_id',
            'id',
            'id',
            'menu_id'
        );
    }

}